package goods

type Goods struct {
	Id         int64
	ShortName  string
	LongName   string
	BrandId    int64
	CategoryId int
	ShopId     int
	Status     byte
	Sale       int

	Attribute []Attribute `gorm:"foreignKey:CategoryId;references:CategoryId"`
}

func (*Goods) TableName() string {
	return "goods"
}

/*
CREATE TABLE `goods_content` (
  `id` bigint(20) NOT NULL,
  `description` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf16;
*/

type GoodsContent struct {
	Id          int64
	Description string
}

func (*GoodsContent) TableName() string {
	return "goods_content"
}

/*
CREATE TABLE `goods_picture` (
  `id` int(11) NOT NULL,
  `url` varchar(255) NOT NULL,
  `goods_id` bigint(20) NOT NULL,
  `is_director` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf16;
*/

type GoodsPicture struct {
	Id         int64
	Url        string
	GoodsId    int
	IsDirector byte
}

func (*GoodsPicture) TableName() string {
	return "goods_picture"
}
